<template>
	<view>
		<view class="goodPart">
			<view class="good" v-for="good in goodList">
				<view class="leftImg">
					<image class="img" :src="good.imgSrc"></image>
				</view>
				<view class="rightInfo">
					<view class="title">{{good.title}}</view>
					<view>原价：{{good.oldPrice}}</view>
					<view class="price">现价：￥{{good.killPrice}}</view>
					<view>开始时间：{{good.killStartTime}}</view>
					<view>结束时间：{{good.killEndTime}}</view>
					<view>描述：{{good.describe}}</view>
				</view>
				<view>
					<button @click.native="jumpDetail(good.id)" class="mini-btn" type="primary"
						size="mini">立即抢购</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		onLoad() {
			this.selSeckillGood();
		},
		data() {
			return {
				goodList: []
			};
		},
		methods: {
			jumpDetail(e) {
				console.log(e);
				uni.navigateTo({
					url: "/pages/seckillGoodDetail/seckillGoodDetail?id=" + e
				})
			},
			selSeckillGood() {
				let jwt = uni.getStorageSync('authority');
				uni.request({
					url: "api/appindex/selKillGood",
					method: 'GET',
					header: {
						"authority": jwt
					},
					success: (res) => {
						console.log(res);
						if (res.data.code == 200) {
							this.goodList = res.data.data;
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f4f4f6;
	}

	.goodPart {
		margin-top: 20rpx;

		.good {
			width: 690rpx;
			height: 300rpx;
			background-color: #fff;
			margin-bottom: 30rpx;
			border-radius: 50rpx;
			padding: 30rpx;
			// box-sizing: border-box;

			.leftImg {
				float: left;
				margin-right: 20rpx;

				.img {
					width: 220rpx;
					height: 220rpx;
					border-radius: 30rpx;
				}
			}

			.rightInfo {
				.title {
					font-size: 39rpx;
				}

				.price {
					font-size: 39rpx;
					color: #ff6601;
				}
			}
		}
	}
</style>